VB_APPS (tm) ------------------------------------------------------------------- version 1.0 for MS-Windows Instruction Manual RESOLUTIONS NOW P.O. BOX 443 BLUE ISLAND, 1L. 60406-0443 copyright, 1993 Philip Rodgers, Jr. All rights reserved. IMPORTANT Read this license agreement carefully before using this software. Use of this software binds you to the terms of this license agreement. Do not use this software if you do not agree to the terms of this agreement. LICENSE AGREEMENT - SINGLE USER The VB_APPS (tm) software is not "Public Domain" or "Freeware". VB_APPS is "Shareware". This is a single user license. Registering VB_APPS for use on more than one computer will require a Multiple User or Site License. 1. COPYRIGHT. VB_APPS is copyrighted 1993 and the copyright owner is Philip Rodgers, Jr. d.b.a. Resolutions Now ("Licensor"), located at P.O. Box 443, Blue Island, IL. 60406-0443. All VB_APPS source code files and documentation ("the software") are protected by United States copyright laws and international treaty provisions. 2. TRADEMARKS. "VB_APPS", all VB_APPS executable file icons, and "Resolutions Now" are trademarks of Philip Rodgers, Jr. 3. GRANT OF LICENSE. Non-registered users of this software are granted a limited license to transfer one copy of the non-registered (i.e. unregistered) software to a single hard drive on a single computer and produce one copy of all documentation for evaluation on a private non- commercial basis, for the express purpose of determining whether the software is suitable to their needs. The evaluation period is not to exceed 30 days. At the end of the evaluation period, you are required to either register your copy by sending the payment as stated in the documentation or discontinue using the software and discard it. Registered users ("Licensee") are granted a non-exclusive license to transfer one copy of the registered software to a single hard drive on a single computer and produce one printed copy of all documentation. Registered users may also make one copy of the software for backup or archival purposes. The software may not be used on a computer that is part of any network. Licensee shall pay Licensor a license fee as stated in the documentation after which Licensee shall become a registered user with a fully paid license. Any other uses require a Multiple User or Site License. Registered users have the right to distribute portions of source code for VB_APPS, provided that: (a) the source code is part of your software product and functions only in conjunction therewith; (b) you do not use Philip Rodgers, Jr's or Resolutions Now's name, logo or trademarks to market your software product; (c) you include a notice of Philip Rodgers Jr.'s copyright of VB_APPS in your software and product documentation; and (d) you agree that Philip Rodgers, Jr. is not liable for the use or distribution of your software product. You may reproduce and distribute copies of the non-registered VB_APPS software, subject to the limitations stated herein, and on the express condition that you do not receive any commercial benefit or other compensation. The recipient(s) to whom you distribute this software must agree to the terms of this Agreement, including the payment of the stated Licensee fees to Licensor upon becoming registered users. Distributors of user-supported software libraries (i.e. operators of electronic bulletin boards, shareware vendors) that charge a disk fee must obtain written permission of Philip Rodgers, Jr. to distribute non-registered copies of VB_APPS. 4. RESTRICTIONS. Except as provided herein, you may not rent, lease, sub-license or otherwise redistribute VB_APPS. You may not reverse engineer, decompile or disassemble the software. U.S. Government Restricted Rights: Use, duplication or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Contractor/Manufacturer is Resolutions Now, P.O. Box 443, Blue Island, IL. 60406-0443. 5. WARRANTY DISCLAIMER. THE VB_APPS SOFTWARE IS LICENSED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY OR IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR DAMAGES, INCLUDING ANY LOST PROFITS OR INCIDENTAL AND CONSEQUENTIAL DAMAGES, EVEN IF THE LICENSOR HAS BEEN ADVISED OF SUCH DAMAGES. Information in this document is subject to change without notice and does not represent a commitment on the part of Philip Rodgers, Jr. No part of the PRINTED instruction manual may be reproduced or transmitted in any form or by any means, without the express written permission of Philip Rodgers, Jr. In other words, the on-disk manual may not be reproduced or distributed in PRINTED (hard copy) form. Microsoft and MS-DOS are registered trademarks of the Microsoft Corporation and MS-Windows (i.e. Windows) are trademarks of the Microsoft Corporation. IBM and PC-DOS are registered trademarks of International Business Machines. DOS refers to both MS-DOS and PC-DOS operating systems. PC Merlin is copyright, 1990 Digital Crypto & Peter Moreton. Portions of VB_APPS were produced with Visual Basic, copyright 1991, Microsoft Corporation. VB_APPS.HLP was produced with Visual Basic Help Compiler, copyright 1991, Microsoft Corporation. '''''''''' N O T E ' ' To register an UNREGISTERED copy of Raffle Do, get a printout ' of this manual. Read registration information on page 58. Fill ' out and mail the payment form on page 59. ' ' Or, choose Registration from the Help menu of any VB_APPS ' program. VB_APPS.HLP will display registration information. ' Follow instructions listed on the form. Address all inquires to: Resolutions Now Customer Support Dept. P.O. Box 443 Blue Island, IL. 60406-0443 Document Number: 1100202 Table of Contents ================= Section One Overview......................................................6 Section Two SetUp.........................................................8 Section Three - Add-On Modules - VHScroll.....................................................13 EnGarde......................................................15 NowTimer.....................................................17 - Applications - Asckey.......................................................21 GetFont......................................................23 OpenUp.......................................................26 VBWorkbench..................................................29 Cryptokey....................................................38 Section Four - Visual Basic Functions - Visual Basic Programming Solutions...........................45 Section Five Other Resolutions Now software Raffle Do.................................................56 Installz..................................................57 REGISTRATION INFORMATION.....................................58 PAYMENT FORM.................................................59 - Page 6 - SECTION ONE =========== OVERVIEW -------- VB_APPS is a library of applications and add-on modules for Visual Basic for Windows programmers. VB_APPS applications provide helpful development tools right out of the box. The unregistered copy of VB_APPS has all code compiled into executable programs. Registered users receive all code. VB_APPS is divided into two categories: A. Add-on modules and applications (executable files): 1. VHScroll - scroll bar code for enhanced object movement 2. EnGarde - simple password add-on with user-changeable passwords 3. NowTimer - sample module with multiple real-time timers that operate simultaneously 4. Asckey - program to retrieve ASCII value of keyboard keys and vise versa 5. Getfont - program to get screen and printer font names 6. OpenUp - program to quickly open one or more program(s) simultaneously 7. VBWorkbench - log program 8. Cryptokey - Windows interface program for PC Merlin, a DOS encryption program B. VB_APPS also includes functions (methods and tips on operating Visual Basic more effectively). Functions includes: 1. How to correctly remove system menu commands 2. Increasing speed of your applications on start up by considering statements which effect other procedures 3. DLL to abort printing to your dot matrix printer 4. Saving files under the DOS format 5. How to handle vbrun100.dll when distributing your applications 6. Setting text boxes to limit user input 7. Handling long directory path names in dialog box label captions The first category is a progression of add-on modules and simple one form Apps to more advanced, multiple form Apps that use code from most add-on modules. This method lets users learn in a step by step, progressive manner. Useful tips, some of which are used in the Apps, follow and provide solutions to some not so common problems. - Page 7 - Help Facility ------------- An on-line Windows help file with registration information is available for VB_APPS. Choose Help + Registration to instantly retrieve information regarding registration. A standard help file is not included since users may alter most applications and add-on modules. Discussion of all VB_APPS software in this instruction manual provide sufficient knowledge. Shortcut and Quick Access Keys ------------------------------ Shortcut Keys Some menu commands have short cut keys. Browse through all menus to locate them. Quick Access Keys Some menu commands have Quick Access Keys. Browse through all menus to locate them. All add-on modules and applications do have two common Quick Access Keys: F1: open vb_apps.hlp to get registration information F12: end operation a VB_APPS add-on module or application Printers Supported ------------------ VB_APPS supports ALL printers that support MS-Windows 3.0 and higher. There are two applications that print documents: VB Workbench and GetFont. These applications are designed to use with dot matrix printers. You can alter print code to produce full size documents on other printers. Tables ====== Tables with Controls and CtlName properties (property tables), Procedures and Descriptions (procedure tables), as seen in the Visual Basic programmer's guide, are included for relevant programs. Some VB users may prefer using these tables rather than browsing through all comments in the code. Additional tables state all forms and modules. - Page 8 - SECTION TWO ============ SETUP ----- Before installing VB_APPS, ensure that your computer and operating system meet minimum hardware and system requirements. Hardware and System Requirements -------------------------------- - IBM or compatible PC with a 80386 processor or higher - A hard disk with 480 KB of available space for the unregistered copy; (470 KB for the registered copy) - 2MB of RAM - A mouse (optional) - An EGA or higher resolution monitor - MS-DOS or PC-DOS 3.1 or higher (or an equivalent DOS that supports Windows) - MS-Windows 3.0 or higher, operating in standard or enhanced mode - Visual Basic 1.0+ for MS-Windows, including vbrun100.dll - Getfont and VBW use a dot matrix printer compatible with MS-Windows 3.0 or higher - Cryptokey requires PC-Merlin 2.0+ NOTE that VB_APPS was tested on the minimum MS-Windows 3.x system requirements to ensure compatibility for all VB_APPS users. A 386SX 16MHz PC with 2MB 100nS RAM, no co-processor, 40MB HD, MS-DOS 3.31, MS-Windows 3.0 and 3.1, a mouse and a 0.31 dp VGA monitor w/256KB VRAM were used. No accelerator cards were used. Files Included On-Disk ---------------------- The unregistered copy of VB_APPS includes one or two 5.25" or one 3.5" floppy diskette(s) with these files: - asckey.exe VB_APPS executable files - engarde.exe - getfont.exe - nowtimer.exe - openup.exe - vhscroll.exe - vbw.exe - ckey.exe - file01.eng external files: file01.eng is for engarde.exe, - openfile.vbn openfile.vbn is for openup.exe, exefiles.vbn is - exefiles.vbn for vbw.exe, and ckey.fle and merlin.pif are for - ckey.fle ckey.exe. - merlin.pif - Page 9 - - vb_apps.hlp Windows help program for vb_apps - vb_apps.txt this document - installz.exe program to install/uninstall VB_APPS files - readme.1st text file with the latest information on VB_APPS - vendor.doc shareware vendor and BBS SysOp information The registered copy of VB_APPS includes two 5.25" or one 3.5" floppy diskette(s) with these files: - vhscroll files: scroll.mak, scroll.frm - engarde files: engarde.mak, engarde.frm - nowtimer files: nowtimer.mak, nowtimer.frm - asckey files: asckey.mak, asckey.frm - getfont files: getfont.mak, getfont.bas, gtfntbas.bas, getfont.frm, prntdlg.frm. - openup files: openup.mak, openglbl.bas, openup.frm, options.frm - vbworkbench files: wrkbench.mak, glbl_wrk.bas, wrk.bas, wrkbench.frm, wrkopen.frm, wrk_time.frm, openbox2.frm, prnt.frm - cryptokey files: ckey.mak, ckey.bas, ckey_mdl.bas, ckey.frm, newbox.frm, destbox.frm - file01.eng external files: file01.eng is for engarde.exe, - openfile.vbn openfile.vbn is for openup.exe, exefiles.vbn is - exefiles.vbn for vbw.exe, and ckey.fle and merlin.pif are for - ckey.fle ckey.exe. - merlin.pif - vb_apps.hlp Windows help program for vb_apps - vb_apps.txt this document - installz.exe program to install/uninstall VB_APPS files - readme.1st text file with the latest information on VB_APPS - vendor.doc shareware vendor and BBS SysOp information Before installing VB_APPS, ensure that all files listed above are included on the VB_APPS disk(s). Consult your DOS or MS- Windows user's guide on how to view files on a diskette. If any files are missing, do not attempt to operate any program. Contact Customer Support Dept. of Resolutions Now or the vendor that sold you VB_APPS. NOTE THAT AN EXTERNAL PROGRAM FILE MUST BE IN THE SAME DIRECTORY AS THE ACTIVE EXECUTABLE FILE OR THE "VB" DIRECTORY (I.E. "C:\VB"). VB_APPS.HLP MUST ALSO BE IN THE SAME DIRECTORY AS THE ACTIVE EXECUTABLE FILE OR THE "VB" DIRECTORY. AS STATED ON PAGE 11, YOU MUST INCLUDE THE PATH ON THE COMMAND LINE UNLESS THE CURRENT DIRECTORY CONTAINS THE EXECUTABLE FILE. THIS IS TRUE, REGARDLESS OF THE INCLUSION OF THE PATH IN THE AUTOEXEC.BAT FILE. - Page 10 - Backup Copies ------------- Before installing or running VB_APPS, make a backup copy of the VB_APPS diskette(s). Consult your DOS or MS-Windows user's guide on how to make a copy of a diskette. Read Documents Before Running VB_APPS --------------------------------------- Read this document and readme.1st before running VB_APPS. Running Installation Program (INSTALLZ.EXE) ---------------------------------------------- Installz.exe installs (copies) or deletes VB_APPS files. Your autoexec.bat, config.sys and win.ini files WILL NOT be altered. ONLY INSTALL VB_APPS FROM THE DOS PROMPT. To install VB_APPS from DOS: 1. Insert VB_APPS disk 1 into correct floppy drive. 2. Switch to the drive with Disk 1. 3. At the prompt type INSTALLZ X ,where X is the number of program disks to be installed. then press the return key. Only include a number if you are installing more than one disk. 4. Installz begins. From the main menu box, choose 1 of 2 options: OPTION 1 starts a query session to set source and destination drives and directories. Next, a full screen menu appears. Answer "Y" to confirm choices and initiate installation. Answer "N" to change a choice. Once installation begins, Installz displays file copy information. Installz will then end and switch to the destination drive and directory. OPTION 2 displays a query box. Answer "Y" to start a query session to retrieve drive and directory with an old (Unregistered) copy of VB_APPS. ALL files in this directory are deleted when installation begins. Installz will then proceed as stated above. To delete VB_APPS files, run Installz by typing INSTALLZ without any parameters. Run Installz from the VB_APPS disk or move it to another directory or drive before deleting VB_APPS files. From the main menu, choose option 3. - Page 11 - OPTION 3 starts a query session to retrieve drive and directory with VB_APPS files for deletion. Only VB_APPS files must be in this directory. All files in the stated directory are displayed. A message states that all files shown will be deleted. Confirm deletion and the DOS Delete command will prompt you to confirm deletion again. Answer "Y" to delete files and its directory. Installz will then end. All errors are self-explanatory. To correct most errors, Installz displays a menu with options. Errors can also occur when copying or deleting files and directories. In this case, DOS will display an error message. Installz will then abort and go to the destination drive. You should then review the contents of the directory with installed VB_APPS files. This directory should contain the files listed on pages 8-9. Remedies: (1) run Installz again. Choose option 2 to remove files before installing VB_APPS again. (2) Use DOS to copy necessary files to destination drive and directories. DO NOT change the name of any file. A VB_APPS executable file will not operate properly if a file name is changed. Only move an executable file if you include its external program file (if any). Running a VB_APPS executable file --------------------------------- You can run an executable file directly from DOS or Windows. Only run an executable file if the corresponding external program file is installed in the correct directory. See pages 8-9. To run an executable file from DOS: 1. At the prompt of the root directory on the correct drive (i.e. c:>), type WIN X\YY.EXE, then press the return key. Note that (X) is the path (i.e. c:\dos) and YY.EXE is the name of a VB_APPS executable file. Or, 1. Go to the directory where you installed a VB_APPS executable file. At its prompt, type WIN YY.EXE. Again, note that YY.EXE is the name of a VB_APPS executable file. To run an executable file from Windows: 1. In the File or Program Manager, choose Run from the File menu. 2. Type X\YY.EXE and click the OK button in the Run dialog box. Again, note that (X) is the path and YY.EXE is the name of a VB_APPS executable file. - Page 12 - Or, 1. In the File Manager, go to the directory where you installed a VB_APPS executable file and double click on the executable file filename. Or, 1. In the Program Manger, go to the group window where you installed a VB_APPS executable file icon. 2. Double click on the icon. - Page 13 - SECTION THREE ============= VHSCROLL ======== VHScroll permits precise picture box or object movement with the VScroll & HScroll bars. VHScroll is useful for users that do not have add-on software with enhanced scroll bar features. You can: 1. Move a picture box left and right, up and down and it can return to its exact initial positions. 2. Use TabStops on scroll bars in re-sizeable forms. VHScroll places the cursor blink (blinking action that appears when scroll bar has the focus) in the cursor box (scroll bar sliding lever). The single form sample App shows what VHScroll can do. A letter-size on-screen picture box in another picture box is controlled by both vertical and horizontal scroll bars. Move either scroll bar and the corresponding Change procedure is activated. The following VScroll_Change procedure from VHScroll illustrates how the vertical scroll bar moves Picture2 up or down. In this example, Picture2.Top = 2440 and VScroll1.Value = 0 on start up. All values are in twips. The user moves the VHScroll cursor box one space (120 twips). Code from VHScroll Results of above example ------------------ ------------------------ Sub VScroll_Change () CurVal2% = VScroll1.Value CurVal2% = 120 m% = CurVal2% - OldVal2% m% = 120 - 0 = 120 Picture2.Top=Picture2.Top - 12 * m% Picture2.Top = 2440 - 12 * 120 = 1000 OldVal22% = CurVal2% OldVal2% = 120 End Sub Picture2.Top is now 1000. It moved down by 1440. Next, the user moves the VScroll1 cursor box back to the topmost position (0 twips; value = 0). The results are: CurVal2% = 0 m% = 0 - 120 = -120 Picture2.Top = 1000 - 12 * (-120) = 1000 - (-1440) = 2440 OldVal2% = 0 Picture2.Top is now at its initial Top position of 2440 twips. You can now use scroll bar TabStops with re sizeable forms. VHScroll accomplishes this by setting the Visible property of the scroll bars to zero in the Form_Resize procedure of the main window. The scroll bars alter their height or width and the Visible property of the scroll bars is set to True in the same procedure. This - Page 14 - causes the scroll bar with the focus to loose the focus. The corresponding LostFocus procedure is then activated and the Set Focus command resets the cursor blink in the scroll bar cursor box. Note - the only code required are the Dim statements, HScroll1_Change, VScroll1_Change, HScroll1_LostFocus, VScroll1_LostFocus and Form_Resize. The values for VScroll1 & HScroll1 are (all settings can be altered): VScroll1 HScroll1 --------------------------------------------- Max 600 400 Min 0 0 LargeChange 60 40 SmallChange 10 10 TabStop True True Review the following tables for more information. Controls CtlName property --------------------------------- Picture box Picture1 Picture box Picture2 Label Label1 Label Label2 Label Label3 Text box Text1 VScroll VScroll1 HScroll HScroll1 Procedure Description ---------------------------------------------------------------- HScroll1_Change Moves Picture2 left or right. HScroll1_LostFocus Resets cursor blink in HScroll1 after Form1 re-sizes, if HScroll1 had focus. VScroll1_Change Moves Picture2 up or down. VScroll1_LostFocus Resets cursor blink in VScroll1 after Form1 re-sizes, if VScroll1 had focus. Form_Load Shows title box and sets Picture1 and 2. Form_Resize Resets all controls if WindowState <> 1. Menu_File1_Click Ends App. Menu_Help1_Click Shows Help file with registration info or About box. Title_MsgBox Displays either Title box or About box. Form FormName Module Module Name -------------------------- ---------------------------- Scroll.frm Form1 make Scroll.mak - Page 15 - ENGARDE ======= NOTE: EnGarde is only intended as an example of how to design and implement a simple password add-on module. Do not use EnGarde with confidential or mission critical applications. Neither Resolutions Now nor the author of EnGarde accepts any responsibility for the use of EnGarde. EnGarde is a simple password protection add-on. Insert it into the Form_Load procedure of the main window of your App. EnGarde code must be the first code in this procedure. EnGarde has user-defined passwords. You can alter its code to: - Exclude the external file, file01.eng, and use a built in non- configurable password. - Add more code to allow multiple valid user passwords. - Add more code to make EnGarde operate in a network environment. When adding EnGarde in your App, only use the code in the EnGarde Form_Load procedure. A review of the code follows. EnGarde is designed as one or a series of input boxes. This greatly reduces the bytes required. An external file stores a password, in random access mode. The information appears garbled when viewed. You can rewrite EnGarde to include forms. MessageOne is the initial message shown in the main input box when the user first encounters EnGarde. MessageTwo appears every time thereafter when the user encounters EnGarde. EnGarde then searches for file01.eng in the current directory or the "VB" directory. If not found, it displays an error message and aborts. If found, two variables are retrieved. Initpass$ is initially set to empty so MessageOne will display when the user first encounters EnGarde. On subsequent uses, EnGarde will give the user two chances to input the correct password. If the user enters the character "1", EnGarde will prompt the user to enter the correct password in order to set a new password. This will only allow valid users to change a password. The user has two chances to enter the correct password. In the sample App, when a correct password is entered or a new password is entered, the Form_Load procedure is exited and the App is opened. If your App has code other than EnGarde in this procedure, place it directly after the line labeled "15". Note that EnGarde will not write to file01.eng unless the password is changed or the sample App resets the contents of the external file. - Page 16 - The single form sample App titled "U.S. Dept. of Fun" consists of a multiple line text box. Users can insert text and password protect it. EnGarde serves as an add-on module to accomplish this task. EnGarde is also used in Cryptokey (ckey.exe). See page 38 or run ckey.exe to see how it is used. Note that the originally set password is "1234", not including the quotation marks. The property and procedure tables will not be listed because they do not effect the use of EnGarde. Additional tables: Form FormName Module Module Name -------------------------- ---------------------------- EnGarde.frm Form1 make EnGarde.mak - Page 17 - NOWTIMER ======== NowTimer is a single form App with timers that display time in hours, minutes and seconds (real time). NowTimer consists of two timers that operate simultaneously and independently. Use NowTimer to time events such as: - User responses - An application start up and exit timer - log application use - Beginning, delaying or ending any application execution To use NowTimer, click the Start button of either timer. The corresponding label caption will display the time as its caption every second. Click the Stop button to end timing. If you click a Start button again, the timer restarts counting at zero. Delete the last line of code in Command2_Click or Command4_Click pro- cedure if you do not want to reset the corresponding timer to zero when starting it. VB Workbench (VBW) uses NowTimer code to log time. VBW adds a pause function through a menu command. See VBW instructions on page 29 and its code for more information. An overview of NowTimer follows. On start up, both timers with their controls are displayed. When you click either Start button, TimerX_Timer procedure is implemented. Note that the interval for each timer control is set to 1000 (one second). The Timer command actually increments the time. The TimerX_Timer procedure is used to continuously update the real time clock display in the corresponding label. The procedure is continuously executed, even if the user is performing another task (use VBW to confirm this). Nowtimer theoretically times up to 99:59:59 before an error occurs. But it is set for a maximum time of 23:59:59. You can add code to time events for days or years. A good example is the log program of VBW. To prevent errors, when you click a Start button, it is disabled until you click its corresponding Stop button. Clicking a Stop button disables the TimerX_Timer procedure. In your App, you can use any action to start or stop a NowTimer - not just command buttons. To create more timers, create an additional Timer control for each timer. Assign a variable statement (i.e. Starter! = Timer) to initiate the timer. Its is a local or global declaration. Place this statement where an action will start the timer (loading a form, clicking a button, etc.). TimerX_Timer procedure must include the same code as shown in either Timer procedure. Note the different names for variables in both Timer procedures. - Page 18 - Depending on the speed of your computer, time may appear to increment erratically from time to time. Since Nowtimer calculates time using the Timer command, it is accessing your computer's clock. Actually, Visual Basic is correctly compensating a lag that may occur when executing the log code. Therefore, the time is accurate. Test the time every minute by comparing the log time with your favorite clock. You may not like the periodic erratic nature of the log timing. If so, try the code below in place of the log time code. Note that you must have a fast computer to accurately log time. Or else, log time will continuously fall behind. If you do not have a fast computer, but still want to try the code below, change the Timer control's interval. It is originally set to 1000 (1 second). 800 or 950 may suffice. In the first sample, the time is incremented by a variable (a!). (a!) is a local or global variable. No timer command or its variables are used (Starter! and StopNow!). Sub Timer1_Timer () a! =a! + 1 'a! is seconds elapsed. '86400 is a 24 hr. period. Timer max is 23:59:59, so reset to 0. If a! > 86400 Then a! = 0 'Same code and comments as in b! = a! / 86400 'NowTimer. c! = Format$(b!, hh:mm:ss) ' Label1.Caption = c$ ' End If The only code added to Command2_Click procedure is: a! = 0 'Resets counter to 0 when user clicks the stop button. Another alternative is to replace the Format$ command with other code. The length of the of code to follow may seem too long. But Visual Basic appeared to execute it faster than the Format$ command. Anyway, if the erratic display continues, you may have learned something - how the Format$ command works in this case. Finally, you can include the above code. Sub Timer1_Timer () ' 'Replace code starting at b! = a!/86400. ' b! = Fix((a!/3600) 'Get the hours. c! = ((a!/3600) - b! * 3600 d! = Fix(c!/60) 'Get the minutes. e! = ((c!/60) - d!) * 60 'Get the seconds. - Page 19 - 'Formats the hours; includes leading zero if necessary. If b! < 10 Then CurHour$ = "0" + Right$(Str$(b!),1) Else CurHour$ = Right$(Str$(b!),2) End If 'Formats the minutes; includes leading zero if necessary. If d! < 10 Then CurMinute$ = "0" + Right$(Str$(d!),1) Else CurMinute$ = Right$(Str$(d!),2) End If 'Formats the seconds; includes leading zero if necessary. If e! < 10 Then CurSecond$ = "0" + Right$(Str$(e!),1) Else CurSecond$ = Right$(Str$(e!),2) End If 'Display the time in real time. Label1.Caption = CurHour$ + ":" + CurMinute$ + ":" + CurMinute$ The tables for NowTimer controls and procedures follow. Controls CtlName property Caption property ----------------------------------------------------------- Frame box Frame1 Timer 1 Frame box Frame2 Timer 2 Command button Command1 &Start Command button Command2 S&top Command button Command3 St&art Command button Command4 St&op Label Label1 Label Label2 Procedure Description ---------------------------------------------------------------- Command1_Click Initiates timing through Timer1_Timer procedure. Command2_Click Stops timing of Timer1_Timer procedure. - Page 20 - Procedure Description ---------------------------------------------------------------- Timer1_Timer Converts time to real time and displays it in Label1. Command3_Click Initiates timing through Timer2_Timer procedure. Command4_Click Stops timing of Timer2_Timer procedure. Timer2_Timer Converts time to real time and displays it in Label2. Menu_File1_Click Ends App. Menu_Help1_Click Shows Help file with registration info or About box. Title_MsgBox Displays either Title box or About box. Form FormName Module Module Name -------------------------- ---------------------------- NowTimer.frm Form1 make nowtimer.mak - Page 21 - ASCKEY ====== Asckey is a single form App that a) converts keyboard input to its ASCII equivalent or b) converts ASCII values to its character equivalent. ASCII values are given only for a to z, 0 to 9, and some special key characters. Asckey is particularly useful to Windows programmers that need to quickly retrieve these values. An overview of its code and instructions for its use follow. When the App is loaded, Picture1 (which contains all character-to- ASCII controls) is enabled and displayed. Its menu command, File+ Find ASCII Value is disabled since it is opened. See Case 0 under Menu_File1_Click procedure. Captions in Label1 give instructions, which is to enter a valid keyboard character. Its ASCII value is immediately displayed. The keyboard character is then highlighted so you can enter another one without clearing it. The Text1_Change and Text1_KeyPress procedure accomplishes this. If you enter a character and no valid ASCII value is displayed, then there may not be a valid ASCII value. If a block type character appears as the ASCII value, then Visual Basic or Windows does not support it. Choose File + Find Character and Picture1 will hide. Picture2 displays. Its menu command is disabled and File + Find ASCII Value menu command is now enabled. Code in Case 1 under Menu_File1_Click procedure accomplishes this. The ASCII-to-character interface is slightly different. Input data of no more than three numbers, then click the OK button to get the character equivalent. Text2_Change and Text2_KeyPress procedures ensure that only 1 to 3 characters are entered in the Text2 box. The Command1_Click procedure converts the ASCII entry into a character and displays it. The text in the Text2 box is highlighted to allow another entry without clearing the text box. The property, procedure and additional information tables follow. Controls CtlName property --------------------------------- Picture box Picture1 Picture box Picture2 Label Label1 Label Label2 Label Label3 Label Label4 Command button Command1 Text box Text1 Text box Text2 - Page 22 - Procedure Description ---------------------------------------------------------------- Form_Load Shows title box. Menu_File1_Click Displays char-to-ASCII or ASCII-to-char picture box; ends App. Command1_Click For ASCII-to-char, converts ASCII to char and displays it. Text1_Change Highlights contents. Text1_KeyPress Converts char-to-ASCII. Text2_Change Gets length of contents and passes it to Text2_KeyPress to ensure maximum input of 3 characters. Text2_KeyPress Allows only a maximum of 3 characters or backspace character to pass to Text2 box. Menu_Help1_Click Shows Help file with registration info or About box. Title_MsgBox Displays either Title box or About box. Form FormName Module Module Name ---------------------------- ---------------------------- Asckey.frm Asckey make Asckey.mak - Page 23 - GETFONT ======= Getfont is a two form App that retrieves all available active screen or printer font names. These font names are displayed on-screen or the user can get a print out. Getfont is useful for any user that wants to retrieve available font names. Programmers can get the valid font name for use with the FontName command. The FontName command under Windows 3.1 will use any font name retrieved, even font names with more than one word. Getfont is easy to use. To display all available active screen font names, click on the "Screen Fonts" button. To display all active available printer font names, click on the "Printer Fonts" button. Both buttons are located in the button ribbon bar, below the menu bar. Font names are loaded into the Combo1 list box. Choose a fontname from the Combo list box and its font type is displayed in label 3. If printer font names are loaded, Visual Basic may not recognize a matching screen font type. Label 4 will state this if it occurs. To printout active font names, choose File + Print... . A print dialog box appears. Ensure that the correct printer is active and set to portrait mode. The option button that corresponds to the currently loaded font names (screen or printer) is checked. You can choose to print either. If the check box is not checked, only the font names are printed in (4 columns). If the check box is checked, the font names are printed in the corresponding font types. Font types are printed in one column. If screen font types are printing and Visual Basic does not handle a matching printer font type, an asterisk denoting this is placed before the font name. Total number of font names are also listed. Font handling is limited by Visual Basic. Examples: a) GetFont can not distinguish and list TTF or another add-on font that is not a standard Windows 3.0 font; b) GetFont cannot distinguish between the different font styles (both Courier Light and Courier Extra Light may display in the combo list box as "Courier"). Another limitation of Visual Basic: open Getfont and retrieve the font names of the printer on port LPT1. Now make the printer on port LPT2 active, then try to retrieve the font names from that printer. GetFont cannot get them. You must restart the application, then retrieve the font names. - Page 24 - Sample times to print font names: - 35 seconds to start printing 50 printer font types to an Epson LQ compatible printer. - 2 minutes to start printing 41 printer font types to an HP II compatible laser printer. - 2 minutes and 20 seconds to start printing 34 screen font types to an HP II compatible laser printer. As noted in the Overview Section, under Printers Supported, Getfont is set to print on a dot matrix printer. It will also print proportionally well on a laser printer. Note that font names, whether displayed in the Combo1 list box or printed, are displayed and printed alphabetically. The property, procedure and additional tables follow. Controls CtlName property Caption ------------------------------------------------------- Getfont.frm ------------ Command button Command1 &Screen Fonts Command button Command2 &Printer Fonts Picture box Picture1 PrntDlg.frm ----------- Command button Command1 O&K Command button Command2 &CANCEL Option button Option1 &Screen Fonts Option button Option2 &Printer Fonts Check box Check1 Print Font &Type Timer Timer1 Procedure Description ---------------------------------------------------------------- Getfont.frm ----------- Command1_Click Load all available screen font names into the Combo1 list box. Command2_Click Load all available printer font names into the Combo1 list box. Form_Load Show title box, center form and load screen font names into Combo1 list box. Form_UnLoad End App if System Menu's Close command is chosen. - Page 25 - Procedure Description ---------------------------------------------------------------- Combo1_Click Show font type (of font name clicked on in Combo1 list box) in label 3. Menu_File1_Click Show Print dialog box or end App. Menu_Help1_Click Shows Help file with registration info or About box. Title_MsgBox Displays either Title box or About box. PrntDlg.frm ----------- Command1_Click OK button clicked. Proceed with printing. Hide form and enable Timer1_Timer procedure. Command2_Click Cancel button clicked. Cancel printing request and unload form. Form_Load Centers print dialog box. Timer1_Timer Print font names or font names and types. Allows enough time for prntdlg.frm to hide. Get_XYPosition Set new CurrentX and Y positions to print or display next font name. Set_InitXYPos Set initial CurrentX and Y to print or print first font name on next printed page. Form FormName Module Module Name ----------------------------- ---------------------------- Getfont.frm Getfont make Getfont.mak PrntDlg.frm PrntDlg global Getfont.bas - Page 26 - OPENUP ====== Openup is a two form App that runs one or more (.exe, .bat, .com or .pif) program(s) simultaneously. On start up, the main window displays in the bottom, left corner. It is small and in that location so users can open and operate other Apps while Openup remains on-screen and easily accessible. If you choose Options + Open All On Start up, you can minimize Openup on start up. Choose Options + Minimize On File Open to minimize Openup when opening a file(s). App names are displayed in the list box on start up. An external file, openfile.vbn, contains the names of executable files that display in the list box (the main list box). Users can choose File + Open + All to open all files in the list box simultaneously, choose File + Open + File to open the highlighted file name only, or choose File + Open + Insert Choice to open a file not listed. When you choose the latter, an input box will display. Insert a file name, including a path if necessary. You can add more file names or delete one or more from the list box. To do so, choose Options + Update File List. The Update File List dialog box appears. It is a modified open dialog box. You can move to another directory or drive the same way you would in any open dialog box. The main difference is that users cannot insert a directory, drive or file name. Choose a file name by clicking on the File List box. Four option buttons at the bottom of the dialog box determine the action taken when the user clicks the OK button. Users can open an App, add an App name to the main list box, open an App and add its name to the main list box, or delete a file name from the main list box. Users can also run all Apps listed in the list box on start up. Choose Options + Open All On Start up. That menu command is then checked. On start up, all Apps listed in the main list box are opened, until you choose this menu command again to cancel it. The property, procedure and additional information tables follow. Controls CtlName property Caption ------------------------------------------------------- Openup.frm ---------- List box List1 Label Label1 Open: Label Label2 - Page 27 - Options.frm ----------- Frame box Frame1 Option button Option1 Open Option button Option2 Add Option button Option3 Open+Add Option button Option4 Delete Command button Command1 O&K Command button Command2 &CANCEL Directory box Dir1 Drive box Drive1 File box File1 List box List1 Label Label1 Label Label2 Label Label3 Label Label4 Procedure Description ---------------------------------------------------------------- Openup.frm ----------- Form_Load Show title box, position main window and retrieve file names from external file. Form_Unload Goes to Update_Exefiles_List before ending Openup. List1_Click Highlight file name in list box so choosing File + Open + File Shown can open it. List1_DblClick Highlights and opens file name in list box. Menu_File1_Click Choose Open to display sub menu or Exit to end Openup. Menu_File2_Click Select Case to open one or all files. Menu_Help1_Click Shows Help file with registration info or About box. Menu_Options1_Click Select Case to show Update File List dialog box, set Open All Files On Start up option, or set Openup windowstate when opening a file(s). Run_Program Opens App highlighted in main list box. Exit_Program Goes to Update_ExeFiles_List before ending Openup. Update_Exefiles_List Open external file and save all file names in main list box. Open_All_Files Open all Apps whose file names are in main list box, if any changes were made. Open_File_Not_Listed Display "Insert Choice" input box. Display_Path Displays path and filename of program name chosen in List1 box. Abbreviate path if necessary. Title_MsgBox Displays either Title box or About box. - Page 28 - Procedure Description ---------------------------------------------------------------- Options.frm ----------- Option1_Click Set variable and Label5 caption to "Open...". Go to Enable_Options_Controls, then Configure_Path procedures. Option2_Click Set variable and Label5 caption to "Add...". Go to Enable_Options_Controls, then Configure_Path procedures. Option3_Click Set variable and Label5 caption to "Open+Add...". Go to Enable_Options_ Controls, then Configure_Path procedures. Option4_Click Set variable and Label5 caption to "Delete...". Go to Enable_Options_ Controls, then Configure_Path procedures. Form_Load Centers form on-screen. Command1_Click OK button clicked. Set new directory. Or Open, Add, Open+Add or Delete file name. Command2_Click Cancel button clicked. Hide form. File1_Click Filename chosen. If Option 1, 2 or 3 is True then go to Configure_Path procedure. File1_DblClick Filename chosen. Go to Command1_Click. Dir1_Click Set variable to inform Options.frm that user wants to change to new directory. Dir1_Change When directory path changes, change File1 path. Drive1_Change Update Dir1 path. List1_Click Filename to delete is chosen. List1_DblClick Filename to delete is chosen. Go to Command1_Click procedure. Configure_Path Configure Option control choice, directory path and File1 filename. Display it in Label5. Abbreviate if necessary. Enable_Options_Controls Set Visible, Enable and TabIndex properties of all controls. Check_For_FileName_ Ensures duplicate program name is Before_Adding not placed in main list box. Form FormName Module Module Name ----------------------------- ---------------------------- Openup.frm Openup make Openup.mak Options.frm Options - Page 29 - VBWORKBENCH =========== VBWorkbench (VBW) is an application that combines Openup with a log program. Every Openup feature is included. When VBW starts up, it appears exactly like Openup. The following instructions will concentrate on the log program. See Openup instructions to use VBW's identical features. The log program, which you can redesign as a stand alone application, is accessible by choosing Options + Show Log or press the F6 key. First, an explanation of the controls, then its entire operation, will follow. The text1 box, labeled "Developer" is for you to insert your company name and address. The text2 box, labeled, "Client" is for you to insert the client's name and address, if any. Fill in these two text boxes, especially if you log time for computer use while working for a client. This information will also be printed on the log report's heading. The text3 box, labeled "Fee", is to insert an hourly fee charged to the client. Only numbers 0-9 and a period character are allowed. This hourly fee multiplied by the total time is displayed in the log data frame box. The total fee and subtotal fees for each session is also printed on the log report. The log data frame box houses the following information: Session timed period: [(Run+Stop) - (Run+Start)]. If you choose Run+Pause, it simply pauses the timed period until you choose Run+Resume or Run+Stop. Once Run+Stop is chosen, that session ends. The timed period is added to the total time. Choose Run+Start again and a new session starts. The time is displayed as: days.hours:minutes:seconds Therefore, theoretically 9999 days & 23:59:59 is the maximum time allowed. VBW stops timing at 9999 days. Log Dates all sessions between periods where you save changes in a file is one log date. For instance, a file is opened and several sessions are timed. Then changes to the file are saved. That is one log date. The instant the first session begins, the starting date of that first session will be saved as the starting date of that log period. - Page 30 - Total the total time of all sessions. Again, the is displayed as shown above. Timing stops at 9999 days. Total Costs total time multiplied by the hourly fee. The max costs displayed is $9,999,999.00. If total costs surpasses this amount, VBW stops the timing process and total cost calculations. An overflow message is displayed. You can continue timing only if the hourly fee is reduced. Starting Date the date when you began timing sessions. Timing a session is easy. There are three commands: Start, Pause/ Resume and Stop. These commands are available through the Run menu bar command. As stated earlier in the explanation for a session, Start begins timing a log session. Pause temporarily halts the timing process until you choose Resume or Stop. Stop halts the timing of that session. Log timing is only as accurate as your system's clock. Saving log data --------------- On a first save attempt, a save dialog box displays. Only a file name to save can be entered into the text box. Change directories or drives by double clicking on the appropriate controls. Visual Basic 1.0+ Professional and VB 2.0+ users can use Window's built in common save dialog box if you want to get full save dialog box access. Note that all files are saved with a (.vbw) extension. Other extensions are invalid. The (.vbw) extension is added if the user does not include one. Note that the Openbox2.frm is working overtime as both an open and save dialog box. The random access mode is used to save a file. The file is saved as records of a fixed string length of 10. When the user saves a new file, the starting date, total time, total days and total number of sessions are saved in the first four record positions. These strings, except starting date, are continuously updated whenever the user saves any changes to the file. The next two records contain information that tracks the next position to write the new session log data and the number of records required for the client name. The second to Nth time you save data to the file will write three records each time, called the session log data. The last position of the third record must be tracked, so the next session log data can be written, starting in the next location. The next location is not the last position plus one, if you included a clients's name. The client's name is always patched on to the end of the file. This is because the user may change the client name or delete it altogether. Therefore, a pre-defined number - Page 31 - of record locations cannot be given to the client's name. As mentioned above, the session log data, in record file allotments of three are saved. The first record position is the date the session began, the second is the number of days for that session and the third is the remaining hh:mm:ss. The following table illustrates the file position allocations and its contents: Position Log data (in order of position) as stored in a file -------- --------------------------------------------------- 1 starting date (StartDate$) 2 total hh:mm:ss (TotalTime$) 3 total days (AddDays$) 4 total sessions (TotSessions$) 5 session date (curlogdate$) 6 number of days this session (SessionDate$) 7 total remaining hh:mm:ss (reallogtime$) * [same type of data recorded in positions 5,6,7 * (Session log data; updated 3 file locations on * every save)] last N client's name (N) depends on number of characters in client's name divided by 10 [this is (c)]. Therefore, (N) is last file position of session log data's third record position (remaining hh:mm:ss) + (c) + I. I is 1 if (c) is a fractional number; else, it is 0. When saving files, note that changing the client's name, but not logging any time will also cause VBW to prompt the user to save file changes. If no client's name is listed, a semi colon will be saved to indicate this. Of course, you can alter part of or the entire file save process, particularly if dBase compatibility is required. You can also use a text editor to edit any client file. Remember, each record position must remain as a string of 10 character spaces. Do not remove a file location or an error will occur. Printing log data ----------------- All data saved is printed in the report form. The report form is an invoice for your client. You can also get hardcopies of logs for personal use. You can get up to 10 copies of the report, print out only the log totals or print out all log session information. Note that you can only print a report of a saved file (designed this way for simplicity). If you just timed a session, choose File + Save to save the file information. Now get a print out of that file. Choose File + Print. Set your printer for portrait mode, beforehand. Click the OK button. Review - Page 32 - the layout and contents of the report. Its layout was setup for a printed form used at Resolutions Now. VB programmers, being a resourceful group, can surely design their own forms. Or blank paper may suffice. Note the heading (the top of the form that ends where log session data is printed). The external file (exefiles.vbn) saves your developer name and invoice number. Every time you print an invoice, its number is incremented. An (x) number of copies will have the same invoice number. The date the invoice was printed is under the invoice number. Also note the inclusion of the client's name, if any, and the hourly fee, if any. Data from each log session is printed, along with session costs. Look at the total cost and you may notice a slight difference between the sum of the session cost and the total cost. All costs are rounded to nearest penny and are correct. Maximum total cost calculated is $9,999,999.00. Note that the log dates are the session dates (curlogdate$). Its total time is (TotSessions$). The time to the left of the period is the number of days for that session (SessionDate$) and the time to the right of the period is the remaining hh:mm:ss (reallogtime$). The time to the left of the period for the total time is the total days (AddDays$) and to the right is the total remaining hh:mm:ss (TotalTime$). A page will list 15 log sessions. If there are more, another page is printed. At the bottom of each page, the current and total amount of pages are listed. Depending on the speed of your computer, time may appear to increment erratically from time to time. NowTimer calculates time using the Timer command, which is accessing your computer's clock. Actually, Visual Basic is correctly compensating a lag that may occur when executing the log code. Therefore, the time is accurate. Test the time every minute by comparing the log time with your favorite clock. You may not like the periodic erratic nature of the log timing. If so, try the code below in place of the log time code. Note that you must have a fast computer to accurately log time. Or else, the log time will continuously fall behind. If you do not have a fast computer, but still want to try the code below, change the Timer control's interval. It is originally set to 1000 (1 second). 800 or 950 may suffice. As shown, the time is incremented by a variable (av!). (av!) is a global variable. No timer command or its variables are used (Starter! and StopNow!). You can replace the Format$ command with code shown under Nowtimer, pages 17-19. - Page 33 - Sub Menu_Run1_Click (Index As Integer) Select Case Index Case 0 'Run + Start 'If timing has started or paused, do not start again. If abcd$ = "0" Or abcd$ = "3" Then Exit Sub Label4.Caption = "0000." 'Reset session days. 'Reset counter to zero. av! = 0 'Go to Timer1_Timer procedure to start timing. Timer1.Enabled = -1 ' ' Same code in procedure after line of code above. ' Case 1 'Run + Pause/Resume 'If timing has started, do If...Then. If abcd$ = "0" Then Timer1.Enabled = 0 'Stop timing. PauseTime! = PauseTime! + av! ' ' Same code in procedure, including Case 2, ' after line of code above. End Select End Sub Sub Timer1_Timer () 'Time is incremented by 1 second by counter. av! = av! + 1 'Add PauseTime!, if any and calculate session time. If PauseTime! > 0 Then av! = av! + PauseTime! ' ' Same code in procedure, starting at "If av! >= 86400 Then" ' End Sub Sub Calculate_Time () 'If timing has not paused do If...Then. If abcd$ <> "3" Then a! = av! 'If timer has paused, log time is pause time. If abcd$ = "3" Then a! = PauseTime! ' ' Same code in procedure, starting at "If av! >= 86400 Then" ' End Sub - Page 34 - The tables for VBW controls and procedures follow. Controls CtlName property Caption ------------------------------------------------------- Wrkbench.frm ------------ Controls, ctlname properties and caption properties are same as Openup.frm in Openup, pages 26-27. Wrk_Open.frm ------------ Controls, ctlname properties and caption properties are same as Options.frm in Openup, page 27. WrkTime.frm ----------- Text box Text1 Text box Text2 Text box Text3 Frame box Frame1 Log Label Label1 &Developer: Label Label2 &Client: Label Label3 &Fee: Label Label4 0000. Label Label5 Log Dates: Label Label6 Session: Label Label7 00:00:00 Label Label8 Total: Label Label9 0000. Label Label10 00:00:00 Label Label11 $0.00 Label Label12 Start Date: Label Label13 12-14-92 Label Label14 0 Label Label15 Total Costs: Openbox2.frm ------------ Label Label1 File &Name: Label Label2 &File: Label Label3 &Directory: Label Label4 D&rive: - Page 35 - Command button Command1 O&K Command button Command2 &CANCEL File box File1 Directory box Dir1 Drive box Drive1 Print.frm --------- Label Label1 C&opies: Text box Text1 Check box Check1 &Totals Only Command button Command1 O&K Command button Command2 &CANCEL Procedure Description ---------------------------------------------------------------- Wrkbench.frm ------------ Same procedures as Openup.frm in Openup, page 27. Wrk_Open.frm ------------ Same procedures as Options.frm in Openup, page 28. Wrk_Time.frm ------------ Form_Load Center form, reset contents, get current directory Menu_File_Click Set enabled state for File+Print menu command depending on status of current file. Menu_File1_Click Handles file menu bar selection. Get new file or open or save a file. Menu_Run1_Click Handles Run menu bar selection. Stop, Pause/Resume or Stop timing a session. Menu_Help1_Click Show registration information or About box. Timer1_Timer Times a session in real time. Displays time on-screen. Text1_Change Sets a condition to inform VBW whether or not changes to developer's name occurred. If yes, save on VBW exit. Text3_Change Sets condition to inform VBW if changes to fee occurred. If yes, save on VBW exit. - Page 36 - Openbox2.frm ------------ Form_Load Center form on-screen, set File1 pattern to (*.vbw), put pattern in text1 box and highlight it. Command1_Click OK button clicked. Depending on state of dialog box (open or save), either go to new directory and/or drive, save file or open file. Command2_Click Cancel button clicked. Get current directory path of dialog box and unload. Dir1_Click Set counter to tell form to change to chosen directory. Dir1_Change Sets File1 path and pattern and puts pattern in text1 box when directory changes. File1_Click Put chosen filename in text1 box. File1_DblClick Filename chosen. Go to Command1_Click. File1_PathChange Set Dir1 path to path of File1. Drive1_Change Set directory path to new drive. Text1_GotFocus Highlight contents of Text1 box. Text1_KeyPress Intercept and preclude all input charac- ters not 0-9, backspace or period. Configure_Path Place current directory in label5. Abbreviate if necessary. Configure_File Configure directory path and filename of file to be opened or saved. Pass it to Command1_Click. Print.frm --------- Form_Load Center form, set initial value for text1 box and highlight it. Command1_Click OK button clicked. Start printing. Command2_Click Cancel button clicked. Cancel request to print report. Timer1_Timer Prints report to active printer. Text1_KeyPress Ensures only 2 characters appear in Text1 box. Text1_GotFocus Highlights contents of Text1 box. Text1_Change Counts number of characters in Text1 box. Passed on to Text1_KeyPress. Print_Log_Heading Prints heading part of report. Wrk.Bas ------- Calculate_Time Calculates session time after Run+Stop of Wrk_Time.frm is chosen or VBW is - Page 37 - ready to exit. Results are displayed and added to total time. Reset_Info Clears log data, including client's name, in Text2 box of Wrk_Time.frm. Then go to Get_Log_Info. Check_FileName Ensures a valid DOS filename is saved. Handle_File Will go to Save_File if file has logged time or client's name has changed. Enable_Options_Controls Set visible, enabled and tabindex properties of all controls in Wrk_Open.frm. Save_New_File Prompts user to save a new file. Save_File Saves changes to an existing file. If file is new, go to Save_New_File. If file is an existing file is loaded, prompt user first. Get_Log_Info Get contents of variables to be saved when user chooses to save a file. Update_Exefiles_List If any changes were made to variables stored in the external program file, save them. Occurs when exiting VBW. Stop_Timer_For_Menu_ Stop timing a session, then go to Calculate_ Choice Time. Occurs only when log window is hidden and user wants to exit VBW. Title_MsgBox Displays either Title box or About box. Display_Costs Calculates total client cost and displays it in log window. Open_File Opens chosen client file. Enacted by File+ Open in log window. If File+Save in log window is chosen and an existing file is loaded, the file's contents are updated on-screen. Form FormName Module Module Name ----------------------------- ---------------------------- Wrkbench.frm Wrkbench make Wrkbench.mak Wrk_Open.frm WorkOpen module Wrk.bas Wrk_Time.frm WorkTime global Glbl_Wrk.bas Openbox2.frm Openform Print.frm Prntform - Page 38 - CRYPTOKEY ========= Cryptokey is a multiple form application that operates as a Windows front end for PC Merlin v2.0+ for DOS. PC Merlin is not included with VB_APPS. Contact your favorite shareware vendor or BBS for more information. Cryptokey is an example of how to design a front end for a DOS program. Cryptokey is useful to current owners of PC Merlin that use Windows but prefer to retain files encrypted by PC Merlin. Cryptokey (ckey) configures the DOS command line for PC Merlin and passes it to PC Merlin; it does not cipher any files. The command line is long. The advantage of ckey is the speed at which you can configure and pass the command line to DOS. Only a correct command line is passed to PC Merlin. A typical command line: merlin c:\dos\hello.txt c:\winword\ /e /k:password /b /s /m:cbc The command line can be much longer if either directory path is longer, a new name for a file is included in the destination path, the key phrase (password) is longer, or vector switch (/v: ...) is included. Configuring the command line is easy. On start up, EnGarde prompts you for your password (see EnGarde, page 15). Note: the originally set password is "1234", not including the quotation marks. Next, the main window appears on-screen. You can insert the source file (and path if necessary), then insert the entire destination directory (i.e. "c:\winword\workfile\"). Note that "\" is the last character of the path unless a new filename is included. Or, choose File + Choose Files to open the Source File dialog box. This dialog box is a modified open dialog box. Note that this dialog box is similar to a Windows 3.1 open dialog box. You can double click on the directory box to go to another directory. You can also click on the file box to choose a file, whose name will appear in the file name text box. You can also double click on the file box to pass the file name to Ckey. There are two differences in this dialog box. You can insert a new name for the file chosen by inserting it into the rename text box. A path command button is also included. Normally, users can click the OK button to go to a new path if it is inserted into the file name text box. But, PC Merlin can cipher one or more files by including wild cards in the source path. So, to go to another path without passing it to the command line, users can click the path button or double click on the directory box. To pass the a path, a file, or wild card options to the PC Merlin command line, click the OK button. - Page 39 - Once a source file(s) is chosen, a message box will prompt you to decide if the source and destination paths are the same. If you choose the YES button, the source file(s) are inserted in the source file name text box in the main window and the same path is also inserted into the destination path text box. Choose the NO button to display the destination dialog box. The destination dialog box is also similar to a basic Windows open dialog box. Note that this dialog box does not include a file box (you must only pass a drive and/or directory path as a destination of the source file(s). There are also other differences. The text box is labeled "Path". Users can insert a new path to go to or to pass to the command line. If the text box is empty when the OK button is clicked to pass the path to the destination path box in the main window, the current path is passed. A Get button is also included. It performs the same function as the path button in the source file dialog box. Note that a new filename, if any, for the source filename is appended to the destination path automatically after a destination path is chosen. Once a source file and destination path are entered, insert the password. Ckey is set for a password that must be at eight to 64 characters long, in accordance with PC Merlin instructions. You can alter the password code to include an 8 byte hexadecimal value also. See Check4_Click procedure in the ckey.frm which verifies the initialization vector. The vector is an 8 byte hexadecimal value. Next, choose an encryption method by clicking on either method option button. Next, you can choose an option from the Option frame box. The three options are switches: a)secure erase will erase the file from the source path if it is not the same as the destination path; b) brief mode will suppress on-screen information, there- fore increasing speed of ciphering; and c) vector will allow user to choose another initialization vector if the encryption mode is not equal to ECB. Finally, choose one of eight encryption modes. The default is ECB. Now the command line is configured. The process becomes fast after several uses. You can review the entire command line, after it is configured, by choosing File + View. - Page 40 - Click the OK button to pass the command line to PC Merlin. Note that PC Merlin must be located at the root directory of the same drive as Ckey. Make sure that ckey.pif is located in the same directory as Ckey or in the same directory as your Windows system files. Ckey.pif will run PC Merlin in a DOS minimized window. Do not operate Ckey or any other application until PC Merlin ends operation. If the command line is incorrect, Ckey will intercept it and inform the user which command line parameter is incorrect. The tables for Cyptokey controls and procedures follow. Controls CtlName property Caption property ----------------------------------------------------------- Ckey.frm -------- Text box Text1 Text box Text2 Text box Text3 Label Label1 &Source File Name Label Label2 &Destination Path Label Label3 &Password Command button Command1 &Run Frame box Frame1 &Encryption Method Frame box Frame2 &Options Frame box Frame3 Encryption Mode Check box Check 2 Secure Erase Check box Check 3 Brief Mode Check box Check 4 Vector Option button Option 7 Encryption Option button Option 8 Decryption Option button Option 9 ECB Option button Option 10 CBC Option button Option 11 CFB Option button Option 12 CFB8 Option button Option 13 OFB Option button Option 14 OFB8 Newbox.frm ---------- Text box Text1 Text box Text2 Label Label1 File &Name Label Label2 R&ename Label Label3 &Files - Page 41 - Label Label4 &Directories Label Label5 D&rives Label Label6 File box File1 Directory box Dir1 Drive box Drive1 Command button Command1 &Ok Command button Command2 &Cancel Command button Command3 &Path Destbox.frm ----------- Text box Text1 Label Label1 &Path Label Label2 &Directories Label Label3 D&rives Label Label4 Directory box Dir1 Drive box Drive1 Command button Command1 &Ok Command button Command2 &Get Procedure Description ---------------------------------------------------------------- Ckey.frm -------- Command1_Click Run button clicked. Pass valid command line to PC Merlin. Menu_FileSelection_Click Chooses a file menu command. Menu_HelpSelection_Click Shows Help file with registration info or About box. Form_Load Run EnGarde code, center form and set initial values for PC Merlin switches. Form_Unload End Ckey if system menu Close command clicked. Timer1_Timer Hide on-screen PC Merlin operation reminder message and set focus on text one box. Check2_Click Sets the secure erase option. Check3_Click Sets the byte suppression option. Check4_Click Sets the initialization vector option. Check7_Click Sets the encryption method to encrypt. Check8_Click Sets the encryption method to decrypt. Check9_Click Sets the encryption mode to ecb. Check10_Click Sets the encryption mode to cbc. Check11_Click Sets the encryption mode to cfb. - Page 42 - Check12_Click Sets the encryption mode to cfb8. Check13_Click Sets the encryption mode to ofb. Check14_Click Sets the encryption mode to ofb8. Text1_Change Informs ckey that a new filename is entered. Text1_GotFocus Highlights contents of text box. Text1_Keypress Intercepts space bar entry to preclude this error. Text2_Change Compares source and destination paths. Sets secure erase option accordingly. Text2_GotFocus Highlights contents of text box. Text2_Keypress Intercepts space bar entry to preclude this error. Text3_GotFocus Highlights contents of text box. Text3_Keypress Intercepts space bar entry to preclude this error. Validate_DestPath Ensures that a valid destination path is entered in text 2 box. Set_Cursor_Focus Set focus on text box with invalid command line parameter if error occurs when OK button is clicked. Validate_SourcePath Verify existence of source path and file(s). Configure_Command_Line Configures command line for PC Merlin. Operate_Merlin Run PC Merlin in minimized window. Title_MsgBox Displays either Title box or About box. Newbox.frm ---------- Command1_Click OK button clicked. Pass source file name to ckey.frm and new filename, if any, to destination path. Command2_Click Cancel button clicked. Close newbox.frm and cancel any choices. Command3_Click Path button clicked. Change to a new drive and/or directory path. Form_Load Pass new pattern from text2 box to file1 box and highlight contents of text2 box. Dir1_Click Go to Check_Dir1 procedure. Dir1_Change Set file1 path to new directory path. File1_Click Filename chosen. Display filename in text2 box. File1_DblClick Filename chosen. Go to Command1_Click. File1_PatternChange Pass new pattern from text2 box to file1 box. File1_PathChange When path changes, put pattern in text2 box. Drive1_Change Set Dir1 path to new Drive1 path. Text2_Change Check for a pattern or filename and set text3 box accordingly. - Page 43 - Text2_GotFocus Highlights contents of text box. Text2_Keypress Intercepts space bar entry to preclude this error. Text3_GotFocus Highlights contents of text box. Text3_Keypress Intercepts space bar entry to preclude this error. Hilite_Text2Box Intercepts space bar entry to preclude this error. Sort_Destination_File Configures destination path and passes it to ckey.frm if source path is equal to destination path. Sort_Source_File Configures source path (and pattern or filename) and passes it to ckey.frm. Config_Dirfile Configure source path and filename. Verify its existence. Path_Err_Msg Display error message if invalid path is entered and path button is clicked. Check_Dir1 Puts directory box selection in text2 box in preparation for a path change. Configure_Path Display current path in label 6. Destbox.frm ----------- Command1_Click OK button clicked. Pass the current path to ckey.frm text1 box. Command2_Click Get button clicked. Changes the path. Form_Load Center form, go to Config_DestPath procedure and highlight contents of text1 box. Dir1_Click Go to Check_Dir1_Too procedure. Dir1_Change Go to Config_DestPath, then Check_Dir1_Too procedures. Drive1_Change Set Dir1 path to new Drive1 path. Hilite_Text1Box Set focus on and highlight contents of text box. Text1_GotFocus Highlights contents of text box. Text1_Keypress Intercepts space bar entry to preclude this error. Check_Dir1_Too Puts directory box selection in text1 box in preparation for a path change. Config_DestPath Display current path in label 4. Sort_Dif_Destination_File Configures destination path (and new filename, if any) and passes it to ckey.frm. - Page 44 - Ckeymdl.bas ----------- Validate_NewFileName Ensures that new filename is in valid DOS format. Invalid_NewFileName If invalid new filename, set focus in text3 box of newbox.frm. If invalid source filename, set focus in text2 box of newbox.frm. Form FormName Module Module Name -------------------------- ---------------------------- ckey.frm ckey make nowtimer.mak newbox.frm newbox module ckeymdl.bas destbox.frm destbox global ckey.bas - Page 45 - SECTION FOUR ============= Visual Basic Functions ====================== As a VB user, I have found some interesting methods and quirks while using Visual Basic. Sharing these not so secret tips will hopefully help you. Note that the following solutions may be expressed in many lines of code. This is so you can easily comprehend the solutions. You can rewrite them as fewer lines of code if necessary. As Visual Basic users, you may have already discovered some of these. ****************************************************************** Note that " --> " means that this line of code is connected to previous line of code; do not separate as shown. ****************************************************************** Ending a program with the main window SysMenu "CLOSE" ----------------------------------------------------- Ending a program with loaded but non-visible forms ------------------------------------------------- Choosing SysMenu "CLOSE" of the main window will unload that window. Loaded but non-visible forms will not unload automatically. The program will continue in run mode. Programs converted to executable files will appear to end. To exit the program, simply type the END command in the Sub Form_ Unload (Cancel As Integer) procedure of the main window. Ending a program with loaded, visible forms ------------------------------------------- Again, simply type the END command in the Sub Form_Unload (Cancel As Integer) procedure of the main window. This unconditionally exits the program - no changes are saved. To save any changes, write code to branch to code that will save changes. Example: The VB Workbench program queries the user to save a new file or any changes to an old file. See the code in the Sub Form_ Unload (Cancel As Integer) procedure. If a change occurs and the user chooses yes, it will automatically branch to a pro- cedure to save changes to an old file or branch to another procedure and allow the user to save a new file. - Page 46 - Removing System Menu Commands ----------------------------- The SysMenu command captions are shown below in Figure 1 with their corresponding indices. When you use DLLs to remove one or more controls, beware. The minimize and/or maximize caption(s) will not appear in the form's SysMenu if the MIN and/or MAX property is set to False. But all indices remain the same. Example: In figure 2 the MAX property of the form is set to False. Since the indices remain the same, the DLL code to remove the Close and hyphen captions remain the same: R = RemoveMenu (HSysMenu, 6, MF_ByPosition) R = RemoveMenu (HSysMenu, 5, MF_ByPosition) See the Windows Programmer's Reference or ICONWORKS code for the API declarations to add/delete System Menu commands. Figure 1. Figure 2. 0 Restore 0 Restore 1 Move 1 Move 2 Size 2 Size 3 Minimize 3 Minimize 4 Maximize 5 or 7 - 5 - 8 Switch To... 6 Close 7 - 8 Switch To... VBRUN100.DLL and distributing software -------------------------------------- You probably know by now that any program that you develop with Visual Basic can run in any directory on your computer without needing VBRUN100.DLL in the same directory. The program will first search for VBRUN100.DLL in the same directory, then look for the "VB" directory. This is an important issue when distributing programs. Of course, all programs for distribution should include VBRUN100.DLL. Exceptions are if the user has Visual Basic or other programs developed with it. If the user has Visual Basic, VBRUN100.DLL must be in the "VB" directory, which cannot be in any sub directory. If the user has other programs developed with Visual Basic, but not Visual Basic, they can save the trouble of putting two or more copies of VBRUN100.DLL on their hard drive. - Page 47 - Simply create a directory named "VB" at the root directory of their hard drive and move VBRUN100.DLL into that directory. Then add "VB" to the PATH command of the autoexec.bat file. All Visual Basic programs will find it and operate correctly. Adding existing files to your project ------------------------------------- When you add an existing file to your current project, the current project and the project that originally contained the file will share this file. To avoid conflicts, save the file (File + Save File As...) immediately after adding a file. Then choose File + Save Project to isolate the added file into your current project. Also change the Form Name to eliminate confusion of identical file names. Choose FormName from the Properties drop down box. Remember to rename all code that referred to the name(s) of non-existent forms. Do this by choosing Code+Replace and click on the Module level check box before choosing OK. Now you can edit the added file. Visual Basic will let you know the path and name of the added file until you close the project or code window. Look at the title bar of the code window of this file. Designing Icons --------------- It is a good idea to design objects with black or dark borders when designing icons. Users will be able to see objects regardless of the desktop background color in use. Notice that most icons included with Visual Basic have objects with borders. Your Apps and the run command line ---------------------------------- When starting your App from DOS or the Windows File or Program Manager, you must include the path with the filename unless you are in the directory that has this App. You can avoid this if your program is in the path specified in your autoexec.bat file. If your App has an external file or help file, you must include the path unless you are in the directory that has this App. Example: You may have several VB Apps in the VB directory. When you start one of these Apps from the run command line, you did not include a path. The installation program of VB appended its path to the PATH command in your autoexec.bat file. But wait. Move one App to a - Page 48 - directory whose path is not included in the PATH command. Try to start this App from a run command line. An error occurs. Now include its path on the run command line and presto...the App runs. This is an important point to remember. Your users must be informed of this, even if your installation program appends the PATH command of the autoexec.bat file. A user may delete the path for your App from the autoexec.bat file. Some guidelines for making help files ------------------------------------- When using Microsoft's Help Compiler for Visual Basic, always give every topic a title. If not, the Windows Help Engine will call this topic untitled. Under Windows 3.1+ this may render the History button useless. Users will not have a title to correspond to the topic - only "Appname: (untitled)" will appear in the History window, where Appname is the name of your App. Also, when you printout the topic, the Print dialog box will state "Printing...(untitled)". ****************************************************************** Note that " --> " means that this line of code is connected to previous line of code; do not separate as shown. ****************************************************************** DLL to abort printing on dot matrix printers -------------------------------------------- This code aborts the current job sent to the printer. Declare the DLL and constants at the global or module level. Then prepare to get the current active port with the second DLL listed below. Place the remaining three lines of code in a procedure that will abort a print job. Note that Curport$, the variable to get the port, is valid only for LPTx or COMx. To get the OS2, FILE or EPT port, use "Code AnyPort" below instead of "Code LPTPort". Declare Function Escape Lib "GDI" (ByVal hDC As Integer, ByVal --> nEscape As Integer, ByVal nCount As Integer, lplnData As Any, --> lpOutData As Any) As Integer Declare Function GetPrivateProfileString Lib "KERNEL" (ByVal --> App$, Key As Any, ByVal Default$, ByVal ret$, ByVal Size%, --> ByVal filename$) As Integer Const ABORTDOC = 2 - Page 49 - Get the current active port; call the 2nd DLL immediately proceeding start of print job. Then store CurPort$. "Code LPTPort" portline$ = Space$(81) gotport% = GetPrivateProfileString("Windows", ByVal "device", --> "", portline$, 80, "WIN.INI") For inn% = 1 To 80 If Mid$(portline$, inn%, 1) = Chr$(0) Then Mid$(portline$, --> inn%, 1) = "," Next inn% 'declare variable locally or globally CurPort$ = Left$(Right$(RTrim$(portline$), 6), 5 3 remaining lines of code are placed in procedure where user will activate abort. winprintnum% = Printer.hDC 'gets the current active printer handle glad% = Escape(winprintnum%, ABORTDOC, 0, CurPort$, "") 'tells Win/3 to end doc and allow further access to printer '(resets access) Printer.EndDoc "Code AnyPort". This is code to retrieve name of port, regardless of length of characters mptr = 1 sptr = 1 portline$ = Space$(81) gotport% = GetPrivateProfileString("Windows", ByVal "device", "", --> portline$, 80, WinIni$) For inn% = 1 To 80 If Mid$(portline$, inn%, 1) = Chr$(0) Then Mid$(portline$, inn%, --> 1) = "," Next inn% sptr = Instr(mptr, portline$, ",") mptr = sptr + 1 sptr = Instr(mptr, portline$, ",") mptr = sptr + 1 sptr = Instr(mptr, portline$, ",") CurPort$ = RTrim$(Ltrim$(Mid$(portline$), mptr, sptr - mptr))) - Page 50 - Saving files under the DOS format --------------------------------- This code ensures that only valid DOS filenames are saved. A save dialog box calls this procedure. Text1 box is in that dialog box and has the name of a file to be saved. "GoodName$" is a global variable. Code assumes no space character input is allowed and only a three character extension is valid. For more code to handle any valid DOS filename, see Validate_NewFileName in ckeymdl.bas module of ckey.exe. Sub Check_FileName () 'If no file name is inserted in text box, file name is bad. If Text1.Text = "" Then Go To Err_Filename 'First, look for period character that signifies existence 'of an extension. getprd% = InStr(1, Text1.Text, ".") 'If only an extension exists, file name is bad. If getprd% = 1 Then Go To Err_Filename 'If none, add an extension (".xxx" is your program's extension). If getprd% = 0 Then Text1.Text = Text1.Text + ".xxx" 'Get character length. If it is more than 12, file name is bad. Geo% = Len(Text1.Text) If Geo% > 12 Go To Err_Filename 'Search each character and limit each to a-z or 0-9, except 'period that signifies an extension. For jn% = 1 To Geo% Srch$ = Left$(Text1.Text, jn%) Chk$ = LCase$(Right$(Srch$, 1)) If (Chk$ < LCase$("a") Or Chk$ > LCase$("z")) --> And (jn% <> Geo% - 3) Then If (Chk$ < LCase$("0") Or Chk$ > LCase$("9")) --> And (jn% <> Geo% - 3) Then Go To Err_Filename End If End If Next jn% 'If file name is valid, set to inform application. Goodname$ = "1" Exit Sub Err_Filename: 'Error code to execute if file name is bad. Beep Msg$ = "Invalid file name. Valid name has 8 characters " Msg$ = Msg$ + Chr$(13) + "maximum and '.xxx' extension" MsgBox (Msg$), 48, yourprogramname$ 'If file name is invalid, set to inform application. Goodname$ = "2" End Sub - Page 51 - Setting text boxes to limit user input -------------------------------------- The following code allows input of up to an (x) amount of characters in a text box. In the first example below, only a maximum input of 4 characters is possible. The TextX_Change and TextX_KeyPress(KeyAscii As Integer) procedures are required. Declare (a!) globally or locally. Sub Text1_Change () a! = Len(Text1.Text) End Sub Sub Text1_KeyPress (KeyAscii As Integer) If a! = 4 Then 'Backspace character is within parenthesis. If KeyAscii <> Asc("") Then KeyAscii = 0 Beep End If End If End Sub In the next example, a maximum of one character can be displayed in the Text1 text box and it is highlighted. This example is used in Asckey. Sub Text1_Change () Text1.SelStart = 0 'Highlights text1 box every time Text1.SelLength = Len(Text1.Text) 'a valid key is pressed. End Sub Sub Text1_KeyPress (KeyAscii As Integer) cbs$ = Chr$(Ascii) '1st 3 lines store key input, clears Text1.Text = "" 'text1 box and displays key input; Text1.Text = cbs$ 'ensures only 1 char will display. ' ' 'Same code as in Asckey procedure. ' End Sub In the final example, Text2 text box allows a maximum of three characters. When the corresponding Command button is clicked, the characters are automatically deleted and the text box resets for another set of characters, with a maximum of three. This example is also used in AscKey. Declare charnum! and charcnt! globally or locally. Sub Text2_Change () charnum! = Len(Text2.Text) End Sub - Page 52 - Sub Text2_KeyPress (KeyAscii As Integer) 'If key pressed <> backspace and <> to a number then kill it. 'Backspace character is within parenthesis. If KeyAscii <> Asc("") Then If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0 Beep Exit Sub End If End If 'If 3 numbers are in text2 box and command1 button pressed then 'store key input, clear text2 box and display key input; 'reset counters. If charnum! = 3 And charcnt! = 1 Then atm$ = Chr$(Ascii) Text2.Text = "" Text2.Text = atm$ charnum! = 1 charcnt! = 0 End If 'If 3 numbers are in text2 box kill all input except backspace key. If charnum! = 3 Then 'Backspace character is within parenthesis. If KeyAscii <> Asc("") Then KeyAscii = 0 Beep End If End If End Sub For...Next Loops ---------------- The range of counting in Visual Basic For...Next loops is X1 to Xn, where X1 is the first number to start the counter and Xn is the last number. Note that if Xn > X1, then Xn must be the last number you want the counter to end at, minus one. Example: the range you want is 1 to 4. Set the counter at 1 to 3. The For...Next loop will loop four times. Mathematical functions and Visual Basic variables ------------------------------------------------- When performing math functions, be careful. For instance, if you are dividing two numbers and want the answer to be a fraction, do not use integer variables (variable%). Use long (variable!). Use of integer variables will result in integers. This was not obvious to me for quite a while. - Page 53 - Code that unconditionally branches to other procedures ------------------------------------------------------ When developing applications, be aware of code that may branch unconditionally to another procedure. Note the use of certain commands, especially on application start up (which will slow down start up). The code below will branch to another procedure. After executing the procedure, Visual Basic returns and resumes execution with the next command. Again, give special attention to below code when including it in the Form_Load() procedure of any form. Move... 'Any of these commands will branch to FormX.Width = Y1 'the Form_Resize procedure. Combine FormX.Height = Y2 'the last 4 commands into one Move FormX.Top = Y3 'command to only cause one branching. FormX.Left = Y4 ComboX... [X is Combo control number (i.e. Combo2. "..." is a control property (i.e. ListIndex. A typical command is Combo2.ListIndex] This code will branch to the ComboX_Click procedure. ListX.ListIndex = Y [X is the List control number and Y is the index number of the control] This code will branch to the ListX_Click procedure. File1.FileName = Text1.Text 'will branch to File1_DblClick 'procedure. Usually used in an open 'or save dialog box with a file box, 'directory and drive boxes, and a 'text box. Dir1.Path = XXX 'will branch to Dir1.Change procedure. Handling long directory path names in dialog box label captions --------------------------------------------------------------- This code abbreviates long directory paths listed in a label on open and save dialog boxes. Assume current directory path is listed in label 5. Note that tgf% equation automatically sets the character limit for a label of any width. Characters must be in lowercase. To use uppercase, set denominator in tgf% equation to a higher number (experiment!). The abbreviated directory path removes the leftmost part of the path and shows the current working path. For example, if the current path is - Page 54 - c:\dos\mathman\integer\fraction and its length is to long for label 5, it can be abbreviated to resemble abbreviated paths seen in most Windows dialog boxes. The path may appear as: c:\...\integer\fraction You can alter the code to remove the rightmost or any part of the path. Do not remove the current working sub-directory. 'See this code in the options.frm of Openup, the wrk_open.frm of 'VBW. This code is altered in Openup and the wrk_open.frm of VBW 'to include a preceding caption and/or trailing filename. Sub Configure_Path () k$ = Right$(Dir1.Path, 1) 'If the root directory is the current path then display it. If k$ = "\" Then Label5.Caption = Dir1.Path 'Else, make sure directory path string fits in label 5. If 'not, abbreviate it. Else 'Set maximum number of characters to appear in label 5. tgf% = Fix(Label5.Width / 110) 'Get length of entire string initially targeted for 'label 5 to compare to tgf% kmd% = Len(Dir1.Path) 'Set space allocated for directory path if it must be 'abbreviated. mvn% = tgf% - 2 'If length of initial caption >= available maximum 'caption space, it will not display properly. Execute 'code in If...Then statement. If kmd% >= tgf% Then 'Get total amount of directory path characters that 'will fit in space allocated for it. jfg$ = Right$(Dir1.Path, mvn%) sdfgk! = Len(jfg$) getchar! = 1 - Page 55 - 'Loop to knock off leftmost directory path characters. 'Abbreviation must at least show current directory. Do Until (qpb$ = "\") Or (getchar! = sdfgk! + 1) wwm$ = Left$(jfg$, getchar!) qpb$ = Right$(wwm$, 1) getchar! = getchar! + 1 Loop 'Get the longest valid rightmost directory path. ccb$ = Mid$(jfg$, getchar!, sdfgk!) 'Show abbreviated path in label 5. If getchar! = sdfgk! + 1 Then Label5.Caption = Left$(Dir1.Path, 2) + "\...\" + ccb$ Else Label5.Caption = Left$(Dir1.Path, 2) + "\...\" + ccb$ End If 'If length of initial caption < available maximum 'caption space, display entire directory path. Else Label5.Caption = Dir1.Path End If End If End Sub - Page 56 - SECTION FIVE ============ Other Software by Resolutions Now --------------------------------- Raffle Do --------- Raffle Do outputs raffle ticket templates to laser printers. Raffle Do also includes Numset (see information below). Additional features include: - Choose either 4x1UP or 4x2UP raffle ticket template. 4x1UP template has four large tickets; 4x2UP template has eight smaller tickets. - Print up to one million tickets, numbered 0 to 999999. - You can start at any number between (0 and 999996) and end at any number between (3 and 999999). - One of the best advantages of Raffle Do is its ability to print only one template for replacement purposes. Don't worry when one or more templates become unusable. Simply print backup copies of one or more templates. Numset is an automated numbering system. Numset is an alternative to small numbering machines & can perform many of the same tasks. - You can sequentially number any sheet that will run through you laser or compatible printer. The range is 0 to 999999. Number documents, self-adhesive labels, pictures, tickets, forms, etc. - You can repeat a sequence of numbers up to 9999 times. - You can skip a number (print only all even or all odd numbers). - Numbers can have the same type of number format as raffle tickets (leading zeros without "No.") - All numbers can have leading and trailing text. To order Raffle Do, choose Registration from the Help menu of any VB_APPS application. Search for "RaffleDo Registration" to display registration information. Read the registration information, then go to the Payment Form. Choose Print Topic from the File Menu of the help window to get a printout. Follow instructions listed on the form. An invoice is also available. Or to order, you can get a printout of this manual. Registration information is on page 58 and the payment form is on page 59. Follow the instructions listed on those two pages. - Page 57 - INSTALLZ ======== Installz is a basic installation utility for programmers and all DOS users alike. DOS users can run Installz to delete unwanted files and its directory, then make a directory and copy files in one step. Programmers will also like features that install files from one or more disk and uninstallation. Forget about programming. Get advantages of an installation program designed for average DOS users. Uses DOS COPY or PKUNZIP. Installz is an executable (.exe) application that is more secure and faster than batch files. Installz is only about 50 kilobytes. - Use familiar step by step installation screens or quick command line entry. - Install files on any drive or directory. - Copy files from any drive or directory. - Instantly make a destination directory. - Ensures that valid source and destination paths are entered. - Install files from one or more floppy disk(s). - Delete all files in a directory before installation. - Delete all files and remove its directory (uninstallation). The only limitations are that Installz cannot be customized and users cannot write to files or retrieve file size. Installz will copy all files located in the source directory unless PKUNZIP is used. Evaluate Installz. VB_APPS includes Installz as its installation program. The Installz instruction manual is not included with VB_APPS, so first read information in the Installz on-disk help section. At the DOS prompt of the directory with Installz, type INSTALLZ HELP and press the return key. Review information that is available through menu options 1, 2, and 4. To order Installz, choose Registration from the Help menu of any VB_APPS application. Search for "Installz Registration" to display registration information. Read the registration information, then go to the Payment Form. Choose Print Topic from the File Menu of the help window to get a printout. Follow instructions listed on the form. An invoice is also available. Or to order, you can get a printout of this manual. Registration information is on page 58 and the payment form is on page 59. Follow the instructions listed on those two pages. - Page 58 - Registration Information ======================== Note the prices and S&H charges for each title. Use it to fill out the payment form on page 59. For more information contact the Customer Accts. Dept. When you register, you get these benefits: - A registered copy of the software, version 1.0. The unregistered and registered copies of Installz (and Raffle Do) include all features. A registered copy of VB_APPS includes all code. - Free assistance by mail to registered users for 90 days. - A 10% discount off the price of the latest version (above 1.0) of any software ordered. - A 10% discount off the price of the second (or more) Resolutions Now registered shareware title. (Example: order Installz and get a 10% discount off of Raffle Do and/or VB_APPS, regardless of how many titles you order). All products and prices are single user. Contact the Customer Acct. Dept. for prices for using software on networks. Network users qualify for the same on-site duplication prices. Product Quantity Price Each S & H (per pkg.) --------------------------------------- ---------------- VB_APPS 1 - 4 $30.00 $ 3.00 inside U.S. version 1.0 5 - 10 $28.00 $ 6.00 to Canada (registered 11 - 24 $26.00 $12.00 overseas copy) 25 + $24.00 --------------------------------------- Raffle Do 1 - 4 $50.00 $ 6.00 inside U.S. version 1.0 5 - 10 $45.00 $10.00 to Canada (registered 11 - 24 $40.00 $20.00 overseas copy) 25 + $35.00 Printed 1 - 4 $10.00 'manual available only instruction 5 - 10 $ 9.00 'with registered copy manual for 11 - 24 $ 8.00 'of Raffle Do Raffle Do 25 + $ 7.00 --------------------------------------- Installz 1 - 4 $20.00 $ 2.50 inside U.S. version 1.0 5 - 10 $19.00 $ 5.00 to Canada (registered 11 - 24 $18.00 $10.00 overseas copy) 25 + $17.00 On-Site duplication of registered software ------------------------------------------ Product Price Each Master Disk ---------------------------------------------------- VB_APPS Subtract $3.00/copy 1 required: $30.00 Raffle Do Subtract $5.00/copy 1 required: $50.00 Installz Subtract $2.00/copy 1 required: $20.00 - Page 59 - PAYMENT FORM ============ To order any Resolutions Now product, complete this form and mail it to the address below. Use only a street address for mailing. We can not ship products to Post Office boxes. The method of payment is either a check or money order drawn on U.S. accounts only. Make all checks and money orders payable to Resolutions Now. NOTE: Illinois residents must add applicable sales tax. Date: __________________ Company: __________________________________________________________ Name: _____________________________________________________________ Street: ___________________________________________________________ City: ______________________________ State: _______________________ Country: ___________________________________ Zip: _________________ Phone: Work(_____)___________________ Home(____)___________________ What did you get a copy of this software from: ____________________ ___________________________________________________________________ PRODUCT NAME QTY. PRICE EACH AMOUNT --------------------------------|-------|-----------|------------ ________________________________|_______|___________|____________ ________________________________|_______|___________|____________ ________________________________|_______|___________|____________ ________________________________|_______|___________|____________ ________________________________|_______|___________|____________ ________________________________|_______|___________|____________ | | All sales are final. All orders are | Sub Total | shipped within 3-4 weeks after receipt |___________|____________ of order by UPS or U.S. mail. | | | Sales Tax | Contact Customer Accounts Dept. for S&H |___________|____________ fees for bulk orders. | | | S & H | |___________|____________ Illinois residents must add applicable | | sales taxes. | TOTAL | |___________|____________ Choose disk format: ( ) 5.25" 360K disk(s); ( ) 3.5" 720K disk(s) Mail check or money order (payable to Resolutions Now) along with this payment form to: Resolutions Now Product Fulfillment Dept. P.O. Box 443 Blue Island, IL. 60406-0443